﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PowerControl
{
    public class MobileAntenna : Antenna
    {
        override public double getGain()
        {
            //Mobile Antenna Power Pattern
            double a = Math.Cos((Math.PI / 4.0) * Math.Cos(this.Position.Pitch+Math.PI/2.0) - 1.0 / Math.Sqrt(2.0));
            double b = Math.Sin(this.Position.Pitch+Math.PI/2.0) * (1.0 - (1.0 / Math.Sqrt(2.0)));
            double powpat = 10.0 * Math.Log10( Math.Pow(a/b, 2.0));
            return powpat * this.gain;
        }
    }
}
